package kr.re.kitri.array;

public class KkangArray {
	/*
	 * 35. shallow copy vs deep copy
	 * */
	public static void main(String[] args) {
		// shallow copy
		int[] a = {1,2,3,4,5};
		int[] b = a;
		b[2]=10;
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]+"\t");			
		}
		System.out.println();
		// deep copy
		int[] c = {2,8,10,33,43,45};
		int[] d = new int[6];		
		System.arraycopy(c, 0, d, 0, c.length);
		for (int i = 0; i < d.length; i++) {
			System.out.print(d[i]+"\t");
		}
		System.out.println();
		d[1]=100;
		for (int i = 0; i < d.length; i++) {
			System.out.print(d[i]+"\t");
		}
	}
}













